#ifndef LOADANDVALIDATEPROXYTASK_H
#define LOADANDVALIDATEPROXYTASK_H

//#include <QObject>
//#include <QThreadPool>
#include "publicstruct.h"

class LoadAndValidateProxyTask : public QObject
{
    Q_OBJECT
public:
    explicit LoadAndValidateProxyTask(const QVector<ProxyServerData> &vPsd,QObject *parent = nullptr);
    ~LoadAndValidateProxyTask();
    QThreadPool threadPool;
public slots:
    void run();
    void stopThread();
signals:
    void started(QString proxy);
    void progress(int current, int total);
    void result(const QString proxy, QString retStr);
    void finished();
    void finishedTask();
    void taskFinish();
    void taskInterrupt();

private:
    // 加载代理列表的逻辑
    QVector<QString> loadProxyList();
    // 分批验证代理
    void batchValidateProxies(const QVector<QString>& proxies);
    void batchValidateProxies(const QVector<ProxyServerData>& proxies);
    bool m_stopThread;
    QVector<ProxyServerData> m_allProxyServer;
    int m_maxThreadNum =50;

};

#endif // LOADANDVALIDATEPROXYTASK_H
